A customised Pie chart
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.pie.js"></script>
Put this where you want the chart to show up:
<div style="margin-left: 50px">
<canvas id="cvs" width="550" height="250">[No canvas support]</canvas>
<div>
This is the code that generates the chart:
<script>
window.onload = function ()
{
var data = [20,13.43,2.83,4.24,7.42,13.43,38.65];
var labels = ['Miscellaneous','Cooking','Office equipment','Refridgeration','Cooling','Ventilation','Lighting'];
for (var i=0; i<data.length; ++i) {
labels[i] = labels[i] + ', ' + data[i] + '%';
}
var pie = new RGraph.Pie({
id: 'cvs',
data: data,
options: {
labels: labels,
labelsSticksList: true,
tooltips: labels,
colors: ['#EC0033','#A0D300','#FFCD00','#00B869','#999999','#FF7300','#004CB0'],
strokestyle: 'white',
linewidth: 0,
shadowOffsetx: 2,
shadowOffsety: 2,
shadowBlur: 3,
exploded: 7,
textAccessible: true
}
}).draw();
};
</script>